
package com.liuheng.spzx.product.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liuheng.spzx.model.entity.product.Category;
import com.liuheng.spzx.product.mapper.CategoryMapper;
import com.liuheng.spzx.product.service.CategoryService;
import com.liuheng.spzx.product.utils.CategoryHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CategoryServiceImpl extends ServiceImpl<CategoryMapper, Category> implements CategoryService {
    @Autowired
    private CategoryMapper categoryMapper;
    @Override
    public List<Category> findCategoryTree() {
        List<Category> categoryList = categoryMapper.selectList(null);
        List<Category> tree = CategoryHelper.getTree(categoryList);
        return tree;
    }
}
